#pragma once

#include "common.h"

/*---------------------------------------------------------------------------*/
/*                                Image Data                                 */
/*---------------------------------------------------------------------------*/

PROGMEM static const uint8_t imgPlayerFrame[9] = { // 9x8
    0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C
};

PROGMEM static const uint8_t imgPlayerBody[7] = { // 7x6
    0x1E, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x1E
};

PROGMEM static const uint8_t imgPlayerFace[3] = { // 3x4
    0x03, 0x08, 0x03
};

#define IMG_LASER_ID_MAX    24

PROGMEM static const uint8_t imgLaserBase[IMG_LASER_ID_MAX][7] = { // 7x7 x24
    { 0x00, 0x7F, 0x00, 0x1C, 0x1C, 0x08, 0x08 },
    { 0x00, 0x0E, 0x70, 0x0E, 0x1C, 0x0C, 0x04 },
    { 0x02, 0x04, 0x1A, 0x66, 0x1E, 0x06, 0x02 },
    { 0x04, 0x08, 0x14, 0x2E, 0x5E, 0x0E, 0x00 },
    { 0x08, 0x08, 0x14, 0x14, 0x2E, 0x5F, 0x00 },
    { 0x10, 0x10, 0x14, 0x2E, 0x2F, 0x28, 0x00 },
    { 0x20, 0x20, 0x2C, 0x2F, 0x2C, 0x20, 0x20 },
    { 0x00, 0x28, 0x2F, 0x2E, 0x14, 0x10, 0x10 },
    { 0x00, 0x6F, 0x2E, 0x14, 0x14, 0x08, 0x08 },
    { 0x00, 0x0E, 0x5E, 0x2E, 0x14, 0x08, 0x04 },
    { 0x02, 0x06, 0x1E, 0x66, 0x1A, 0x04, 0x02 },
    { 0x04, 0x0C, 0x1C, 0x0E, 0x70, 0x0E, 0x00 },
    { 0x08, 0x08, 0x1C, 0x1C, 0x00, 0x7F, 0x00 },
    { 0x10, 0x18, 0x1C, 0x38, 0x07, 0x38, 0x00 },
    { 0x20, 0x30, 0x3C, 0x33, 0x2C, 0x10, 0x20 },
    { 0x00, 0x38, 0x3D, 0x3A, 0x14, 0x08, 0x10 },
    { 0x00, 0x7D, 0x3A, 0x14, 0x14, 0x08, 0x08 },
    { 0x00, 0x0A, 0x7A, 0x3A, 0x14, 0x04, 0x04 },
    { 0x02, 0x02, 0x1A, 0x7A, 0x1A, 0x02, 0x02 },
    { 0x04, 0x04, 0x14, 0x3A, 0x7A, 0x0A, 0x00 },
    { 0x08, 0x08, 0x14, 0x14, 0x3A, 0x7D, 0x00 },
    { 0x10, 0x08, 0x14, 0x3A, 0x3D, 0x38, 0x00 },
    { 0x20, 0x10, 0x2C, 0x33, 0x3C, 0x30, 0x20 },
    { 0x00, 0x38, 0x07, 0x38, 0x1C, 0x18, 0x10 },
};

PROGMEM static const uint8_t imgLaserNeck[IMG_LASER_ID_MAX][3] = { // 3x3 x24
    { 0x07, 0x00, 0x00 }, { 0x03, 0x04, 0x00 }, { 0x01, 0x06, 0x00 },
    { 0x02, 0x04, 0x00 }, { 0x02, 0x02, 0x04 }, { 0x02, 0x04, 0x04 },
    { 0x04, 0x04, 0x04 }, { 0x04, 0x04, 0x02 }, { 0x04, 0x02, 0x02 },
    { 0x00, 0x04, 0x02 }, { 0x00, 0x06, 0x01 }, { 0x00, 0x04, 0x03 },
    { 0x00, 0x00, 0x07 }, { 0x00, 0x01, 0x06 }, { 0x00, 0x03, 0x04 },
    { 0x00, 0x01, 0x02 }, { 0x01, 0x02, 0x02 }, { 0x01, 0x01, 0x02 },
    { 0x01, 0x01, 0x01 }, { 0x02, 0x01, 0x01 }, { 0x02, 0x02, 0x01 },
    { 0x02, 0x01, 0x00 }, { 0x04, 0x03, 0x00 }, { 0x06, 0x01, 0x00 },
};

PROGMEM static const uint8_t imgReady[98] = { // 49x15
    0x00, 0xC0, 0xFE, 0xFE, 0xC6, 0xE2, 0x32, 0x3E, 0x1C, 0x00, 0x00, 0xC0, 0xE0, 0xA0, 0xE0, 0xE0,
    0x00, 0x00, 0x80, 0xC0, 0x60, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x20, 0xF0, 0xFF,
    0x3F, 0x03, 0xC0, 0xE0, 0xE0, 0x00, 0x80, 0xE0, 0xE0, 0x08, 0x0C, 0xCC, 0xC6, 0x62, 0x72, 0x3E,
    0x1C, 0x0E, 0x0F, 0x03, 0x01, 0x00, 0x01, 0x07, 0x0E, 0x0C, 0x00, 0x07, 0x0F, 0x09, 0x09, 0x0C,
    0x06, 0x06, 0x0F, 0x0F, 0x0C, 0x06, 0x0F, 0x0F, 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x0C, 0x06, 0x0F,
    0x0F, 0x00, 0x40, 0x47, 0x67, 0x34, 0x3E, 0x1F, 0x07, 0x01, 0x00, 0x0C, 0x0D, 0x0D, 0x00, 0x00,
    0x00, 0x00,
};

PROGMEM static const uint8_t imgGameOver[154] = { // 77x11
    0xC0, 0xF0, 0x38, 0x4C, 0x66, 0x23, 0xF1, 0xF3, 0x73, 0x00, 0x80, 0xC0, 0x60, 0x30, 0xF0, 0xF0,
    0x70, 0x00, 0xC0, 0xF0, 0x70, 0x20, 0xF0, 0xF0, 0x70, 0x20, 0x30, 0xF0, 0xF0, 0xF0, 0x00, 0x80,
    0xE0, 0xF0, 0xD0, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0x3C, 0x0E, 0x07,
    0x03, 0x03, 0xC3, 0xFF, 0x3E, 0x00, 0xF0, 0xF0, 0xE0, 0x00, 0xC0, 0xE0, 0x70, 0x30, 0x80, 0xE0,
    0xF0, 0xD0, 0x70, 0x70, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x30, 0x10, 0x30, 0x30, 0x03, 0x07, 0x06,
    0x04, 0x06, 0x03, 0x03, 0x01, 0x00, 0x00, 0x07, 0x07, 0x06, 0x03, 0x07, 0x07, 0x00, 0x06, 0x07,
    0x03, 0x00, 0x07, 0x07, 0x03, 0x00, 0x00, 0x06, 0x07, 0x03, 0x00, 0x00, 0x03, 0x07, 0x04, 0x04,
    0x06, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x04, 0x04, 0x04, 0x06, 0x03, 0x01,
    0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x01, 0x00, 0x00, 0x00, 0x03, 0x07, 0x04, 0x04, 0x06,
    0x03, 0x03, 0x00, 0x07, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00,
};

PROGMEM static const uint8_t imgFigures[10][8] = { // 8x8 x10
    { 0x70, 0xFC, 0x8E, 0x83, 0xC1, 0x71, 0x3F, 0x0E },
    { 0x00, 0x00, 0xC0, 0xF9, 0x3F, 0x07, 0x01, 0x00 },
    { 0x80, 0xC0, 0xE2, 0xA3, 0xB1, 0x91, 0x9F, 0x8E },
    { 0x40, 0xC0, 0x82, 0x8B, 0xC9, 0x79, 0x3F, 0x06 },
    { 0x18, 0x1C, 0x16, 0x13, 0xF1, 0xFC, 0x1F, 0x13 },
    { 0x40, 0xC0, 0x8C, 0x8F, 0xCB, 0x79, 0x31, 0x01 },
    { 0x00, 0x78, 0xFC, 0x9E, 0x8B, 0xF9, 0x73, 0x02 },
    { 0x00, 0xC1, 0xF1, 0x39, 0x0D, 0x07, 0x03, 0x01 },
    { 0x60, 0xF6, 0x9F, 0x99, 0xFD, 0x67, 0x02, 0x02 },
    { 0x80, 0x8E, 0x9F, 0xD1, 0x79, 0x3F, 0x0E, 0x00 },
};

/*---------------------------------------------------------------------------*/
/*                                Sound Data                                 */
/*---------------------------------------------------------------------------*/

enum {
    SND_PRIO_START = 0,
    SND_PRIO_OVER,
    SND_PRIO_HIT,
    SND_PRIO_TOGGLE,
    SND_PRIO_LASER,
};

PROGMEM static const byte soundStart[] = {
    0x90, 72, 0, 100, 0x90, 74, 0, 100, 0x90, 76, 0, 100,
    0x90, 77, 0, 100, 0x90, 79, 0, 200, 0x80, 0xF0
};

PROGMEM static const byte soundOver[] = {
    0x90, 55, 0, 120, 0x90, 54, 0, 140, 0x90, 53, 0, 160, 0x90, 52, 0, 180,
    0x90, 51, 0, 200, 0x90, 50, 0, 220, 0x90, 49, 0, 240, 0x90, 48, 0, 260, 0x80, 0xF0
};

PROGMEM static const byte soundToggle[] = {
    0x90, 53, 0, 15, 0x90, 65, 0, 15, 0x90, 77, 0, 15, 0x80, 0xF0
};

PROGMEM static const byte soundLaserWhite[] = {
    0x90, 106, 0, 80, 0x90, 94, 0, 20, 0x90, 106, 0, 40, 0x90, 94, 0, 20,
    0x90, 106, 0, 20, 0x90, 94, 0, 20, 0x90, 106, 0, 10, 0x80, 0xF0
};

PROGMEM static const byte soundLaserBlack[] = {
    0x90, 100, 0, 80, 0x90, 85, 0, 20, 0x90, 100, 0, 40, 0x90, 85, 0, 20,
    0x90, 100, 0, 20, 0x90, 85, 0, 20, 0x90, 100, 0, 10, 0x80, 0xF0
};

PROGMEM static const byte soundAbsorb[] = {
    0x90, 115, 0, 25, 0x90, 112, 0, 25, 0x90, 116, 0, 25, 0x90, 114, 0, 25, 0xE0
};

PROGMEM static const byte soundDamage[] = {
    0x90, 48, 0, 5, 0x90, 71, 0, 5, 0x90, 29, 0, 5, 0x90, 52, 0, 5,
    0x90, 83, 0, 5, 0x90, 35, 0, 5, 0x90, 67, 0, 5, 0x90, 91, 0, 5, 0xE0
};
